#include <stdio.h>
#include "array.h"

/* Statistics. */

int stat_delta(struct array *ary, unsigned long long total_len) {
    unsigned long long len, j, prev_loc;
  double delta, delta_sum;

/* Sum up differences in translocation positions */
len = array_length(ary);
for (j=0; j<len; j++) {
  register unsigned long long cur_loc;
  cur_loc = *(unsigned long long *)array_get(ary, j);
  delta = (cur_loc-prev_loc)/(double)total_len;
  delta_sum += delta;
  //printf("%2.8f ", delta);
  prev_loc = cur_loc;
 } /* rof j */
printf(" mean=%3.8f\n", delta_sum/len);
  
  return 0;
  }

